package com.xxx.kjds.serviceImpl;

import com.xxx.kjds.entity.WishList;
import com.xxx.kjds.entity.WishListExample;
import com.xxx.kjds.mapper.WishListMapper;
import com.xxx.kjds.service.WishlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WishlistServiceImpl implements WishlistService {
    @Autowired
    private WishListMapper wishListMapper;

    @Override
    public long countByExample(WishListExample example) {
        return wishListMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(WishListExample example) {
        return wishListMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return wishListMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(WishList record) {
        return wishListMapper.insert(record);
    }

    @Override
    public int insertSelective(WishList record) {
        return wishListMapper.insertSelective(record);
    }

    @Override
    public List<WishList> selectByExample(WishListExample example) {
        return wishListMapper.selectByExample(example);
    }

    @Override
    public WishList selectByPrimaryKey(Integer id) {
        return wishListMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(WishList record, WishListExample example) {
        return wishListMapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(WishList record, WishListExample example) {
        return wishListMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(WishList record) {
        return wishListMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(WishList record) {
        return wishListMapper.updateByPrimaryKey(record);
    }

    @Override
    public WishList selectByUid(Integer uid) {
        WishListExample WishListExample = new WishListExample();
        WishListExample.Criteria criteria = WishListExample.createCriteria();
        criteria.andBvoIdEqualTo(uid);
        List<WishList> list = wishListMapper.selectByExample(WishListExample);
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }
}
